﻿/*-------------------------------------
//
//Copyright (C) 2007 开发二组 版权所有。
//
//文件名：ProductInfo.ascx.cs
//
//
//文件功能描述：对商品的详细信息进行介绍
//
//
//创建标识：2007.11.22 何卫红
//创建描述：商品详细信息..
//
 //修改:2007.12.5 王志平
 //删除了商品的简单描述.
//------------------------------------*/

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using JXMSTC.SmartBusiness.BFL.BLLFactory;
using JXMSTC.SmartBusiness.BFL.IBLL;

public partial class UserControl_ProductInfo : System.Web.UI.UserControl
{
    //定义WebService商品类实例
    localhost.ProductService product = new localhost.ProductService();
    protected void Page_Load(object sender, EventArgs e)
    {
        //初始页面时获取数据信息
        if (!IsPostBack)
        {
            GetProduct();
        }
    }

   /// <summary>
   /// 异步调用依据商品ID获取数据信息
   /// </summary>
    protected void GetProduct()
    {
        string ProductID = Convert.ToString(Request.QueryString["productID"]);
        product.GetProductInfoByProductIDCompleted += new localhost.GetProductInfoByProductIDCompletedEventHandler(product_GetProductInfoByProductIDCompleted);
        product.GetProductInfoByProductIDAsync(ProductID);
    }

    //回调方法，获取数据结果
    void product_GetProductInfoByProductIDCompleted(object sender, localhost.GetProductInfoByProductIDCompletedEventArgs e)
    {
        localhost.V_Product productInfo = new localhost.V_Product();

        productInfo = e.Result;


        //将实体中的属性值显示出来
        this.lblProductName.Text = productInfo.Name;
        this.lblProductID.Text = productInfo.ProductID;

        this.lblPrice.Text = productInfo.SalesPrice.ToString();
        this.lblProductCount.Text = productInfo.Unit;
        this.ltlContent.Text = productInfo.Description;



        ibtnProduct.ImageUrl = "../imagInfo.aspx?productID=" + productInfo.ProductID;
    }
  
    //将商品加入购物车
    protected void ibtnSaveInCart_Click(object sender, ImageClickEventArgs e)
    {
        //string ProductID = Request.QueryString["ProductID"];
        Response.Redirect("ManageCart.aspx?productID="+this.lblProductID.Text);
    }
  
}
